<template>
  <div class="container">
    <div class="ad">
      <img :src="adImg" alt="" />
    </div>
    <div class="item-list">
      <item-list
        v-for="item in itemList"
        :item="item"
        :key="item.id"
      ></item-list>
    </div>
  </div>
</template>

<script>
import itemList from "@/components/item-small-img.vue";
import { getVipGoods } from "@/api/mall";

export default {
  data() {
    return {
      adImg: "",
      itemList: [],
      page: 1
    };
  },
  created() {
    getVipGoods({ page: 1 }).then(res => {
      if (res.status === 200) {
        this.adImg = res.data.data.image;
        this.itemList = res.data.data.commodity;
      }
    });
  },
  components: {
    itemList
  }
};
</script>

<style lang="less" scoped>
.container {
  min-height: 100%;
  height: auto;

  .ad {
    height: 4.2rem;
    background-color: #dfdfdf;
    width: 100%;
    overflow: hidden;

    img {
      width: 100%;
    }
  }

  .item-list {
    margin-top: 0.48rem;
  }
}
</style>
